package fractal.view;

import fractal.action.AppAction;
import javax.swing.JMenuItem;
import javax.swing.KeyStroke;

/** Class extends JMenuItem */
public class MenuItem extends JMenuItem {

	/** constructor argument: item name, action name */
	public MenuItem(String itemName, String actionName) {
		super(itemName);
		super.addActionListener(new AppAction(actionName));
	}

	/** constructor argument: item name, action name, application view */
	public MenuItem(String itemName, String actionName, AppView appView) {
		super(itemName);
		super.addActionListener(new AppAction(actionName, appView));
	}

	/** constructor argument: item name, action name, key shortcut */
	public MenuItem(String itemName, String actionName, KeyStroke keyStroke) {
		super(itemName);
		super.setAccelerator(keyStroke);
		super.addActionListener(new AppAction(actionName));
	}

	/** constructor argument: item name, action name, key shortcut, application view */
	public MenuItem(String itemName, String actionName, KeyStroke keyStroke, AppView appView) {
		super(itemName);
		super.setAccelerator(keyStroke);
		super.addActionListener(new AppAction(actionName, appView));
	}
}
